﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;

namespace NHibernateTest
{
    
    public class Dept
    {
        private int deptNo;
        private string deptName;
        private IList<Employee> employees;

        public virtual int DeptNo
        {
            get { return deptNo; }
            set { deptNo = value; }
        }

        public virtual string DeptName
        {
            get { return deptName; }
            set { deptName = value; }
        }

        public virtual IList<Employee> Employees
        {
            get { return employees; }
            set { employees = value; }
        }
    }

    public class DeptMapClass : ClassMap<Dept>
    {
        public DeptMapClass()
        {
            Table("test_department");
            Id(dept => dept.DeptNo).Column("dept_no");
            Map(dept => dept.DeptName, "dept_name").Not.Nullable().Length(50);

            HasMany(dept => dept.Employees);
        }
    }
}
